﻿<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Reserve.aspx.cs" Inherits="Physio_Clinic._Default" %>

<%@ Register assembly="DayPilot" namespace="DayPilot.Web.Ui" tagprefix="DayPilot" %>
<%@ Register assembly="Devart.Data.Linq.Web, Version=3.1.34.0, Culture=neutral, PublicKeyToken=09af7300eec23701" namespace="Devart.Data.Linq.Web" tagprefix="cc1" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
    <style type="text/css">
        .style1
        {
            color: #9933FF;
            font-weight: bold;
        }
    </style>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">

    <% if (Request.QueryString["userId"] != null && currentUser != null || Session["userId"] != null)
       {   
      %>
    <asp:Panel ID="Panel1" runat="server">
        <br />
        ยินดีต้อนรับคุณ
        <asp:Label ID="userText" runat="server" 
            style="color: #9900FF; font-weight: 700" Text="Label"></asp:Label>
        <br />
        <br />
        <div>
            &nbsp;
             

            <asp:LinqDataSource ID="LinqDataSource1" runat="server" 
                ContextTypeName="Physio10Context.Physio10DataContext" EntityTypeName="" 
                TableName="Bookingtimes" 
                Where="Available == @Available &amp;&amp; Date == Convert.ToDateTime(@Date)">
                <WhereParameters>
                    <asp:Parameter DefaultValue="true" Name="Available" Type="Boolean" />
                    <asp:ControlParameter ControlID="DateCalendar" Name="Date" 
                        PropertyName="SelectedDate" Type="DateTime" />
                </WhereParameters>
            </asp:LinqDataSource>
            <asp:Table ID="MyTable" runat="server" border="1" cellpadding="5" 
                cellspacing="0" Height="132px" Width="494px">
                <asp:TableRow ID="TableRow1" runat="server" BackColor="Orange">
                    <asp:TableCell ID="TableCell1" runat="server" colspan="2">
                    <asp:Label id="Label4" text="ทำนัดหมาย" runat="Server" 
                    ForeColor="White" />
                </asp:TableCell></asp:TableRow><asp:TableRow ID="TableRow2" runat="server"><asp:TableCell 
                        ID="TableCell2" runat="server">
                    
                    <asp:Label ID="Label5" runat="server" Text="เลือกวันที่*"></asp:Label>
               
                </asp:TableCell><asp:TableCell ID="TableCell4" runat="server">
                    
                <asp:Calendar ID="DateCalendar" runat="server" 
                onselectionchanged="DateCalendar_SelectionChanged"></asp:Calendar>   
               
                </asp:TableCell></asp:TableRow><asp:TableRow ID="TableRow4" runat="server"><asp:TableCell 
                        ID="TableCell6" runat="server">
                    
                    <asp:Label ID="Label2" runat="server" Text="เเพทย์"></asp:Label>
               
                </asp:TableCell><asp:TableCell ID="TableCell7" runat="server">
                    
                   <asp:Label ID="DoctorToday" runat="server" Text="N/A"></asp:Label>

                </asp:TableCell></asp:TableRow><asp:TableRow ID="TableRow3" runat="server"><asp:TableCell 
                        ID="TableCell3" runat="server">
                    
                    <asp:Label ID="Label1" runat="server" Text="เลือกเวลา*"></asp:Label>
               
                </asp:TableCell><asp:TableCell ID="TableCell5" runat="server">
                    
                                <asp:DropDownList ID="TimeReserve" runat="server" 
                DataSourceID="LinqDataSource1" DataTextField="TimeText" 
                DataValueField="BookingTimeId">
            </asp:DropDownList>
               
                </asp:TableCell></asp:TableRow><asp:TableRow ID="TableRow5" runat="server">
               
               <asp:TableCell 
                        ID="TableCell8" runat="server">
               
                </asp:TableCell><asp:TableCell ID="TableCell9" runat="server">

                                       <asp:Button ID="Button1" runat="server" onclick="Button1_Click" 
            Text="ทำนัด" Width="130px" />
               
                </asp:TableCell></asp:TableRow></asp:Table><br /></div><br /><span 
            class="style1">ตารางการจองเวลาของคลีนิค</span> <asp:RadioButton  
            ID="RadioButton4" runat="server" AutoPostBack="True" Checked="True" 
            GroupName="Calendar" oncheckedchanged="RadioButton4_CheckedChanged" 
            Text="วัน" Visible="False"  /><asp:RadioButton ID="RadioButton5" 
            runat="server" AutoPostBack="True" GroupName="Calendar" 
            oncheckedchanged="RadioButton5_CheckedChanged" Text="สัปดาห์" 
            Visible="False" /><br /><br /> <DayPilot:DayPilotCalendar 
            ID="DayPilotCalendar1" runat="server" 
            TimeFormat="Clock24Hours" BackColor="#FFFFD5" BorderColor="Black" 
            DayFontFamily="Tahoma" DayFontSize="10pt" DurationBarColor="Blue" 
            EventBackColor="White" EventBorderColor="Black" EventFontFamily="Tahoma" 
            EventFontSize="8pt" EventHoverColor="Gainsboro" HourBorderColor="#EAD098" 
            HourFontFamily="Tahoma" HourFontSize="16pt" HourHalfBorderColor="#F3E4B1" 
            HourNameBackColor="#ECE9D8" HourNameBorderColor="#ACA899" HoverColor="#FFED95" 
            NonBusinessBackColor="#FFF4BC" NonBusinessHours="Hide" 
            StartDate="2012-02-16" DataEndField="EndappointmentTime" 
            DataSourceID="LinqDataSource" DataStartField="AppointmentTime" 
            DataTextField="UserName" DataValueField="bookId" BusinessBeginsHour="10" 
            BusinessEndsHour="21" EventClickJavaScript="" FreeTimeClickJavaScript="" 
            oneventclick="DayPilotCalendar1_EventClick" HourHeight="60" 
            EventClickHandling="PostBack" /><asp:LinqDataSource 
            ID="LinqDataSource" runat="server" 
            ContextTypeName="Physio10Context.Physio10DataContext" EntityTypeName="" 
            TableName="Bookings"></asp:LinqDataSource><br /><br /><br /><br />
        
    </asp:Panel>
    <% }
       else
       { %><asp:Label ID="ErrorText" runat="server" 
    Text="คุณยังไม่ได้เข้าระบบ กรุณาเข้าสู้ระบบก่อน" ForeColor="Red" 
        style="text-align: center"></asp:Label><asp:HyperLink ID="HyperLink1" 
    runat="server" NavigateUrl="http://physio10.com/" > click</asp:HyperLink><% } %></asp:Content>